package com.activity.Interface;

import com.activity.gaswatchermtl.R;
import com.activity.gaswatchermtl.R.layout;
import com.activity.gaswatchermtl.R.menu;
import com.activity.gaswatchermtl.StartActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class ChoixLogin extends Activity {

	private Button boutonUser = null;
	private Button boutonGuest = null;

	private View.OnClickListener clickListenerBoutons = new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			Intent secondeActivite;

			switch(v.getId())
			{
			case R.id.button1 : // bouton 
				secondeActivite = new Intent(ChoixLogin.this, LoginActivity.class);
				startActivity(secondeActivite);
				break;
			case R.id.button2 : // bouton 
				secondeActivite = new Intent(ChoixLogin.this, StartActivity.class);
				startActivity(secondeActivite);
		        finish();
				break;
			}
		}
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_choix_login);
		
		// On cherche les boutons et on les assigne au OnClickListener
		boutonUser = (Button) findViewById(R.id.button1);
		boutonUser.setOnClickListener(clickListenerBoutons);

		boutonGuest = (Button) findViewById(R.id.button2);
		boutonGuest.setOnClickListener(clickListenerBoutons);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_choix_login, menu);
		return true;
	}

}
